package com.bsoft.gol.hcs.clinical.clinicalEnum;


/**
 * 用药字典
 */

public enum DicCodeEnum {
    DRUG_FREQUENCY("drug_frequency", "2","用药频次"),//频次
    DRUG_USAGE("drug_usage", "1","给药途径"),//给药途径
    FOOT_NOTE("foot_note","4","脚注"),//脚注
    MEDICATION_DECOCTION("medication_decoction","3","煎法");//煎法

    DicCodeEnum(String title, String type,String context) {
        this.title = title;
        this.type = type;
        this.context = context;
    }

    private String title;
    private String type;
    private String context;

    public String getType() {
        return type;
    }

    public String getTitle() {
        return title;
    }

    public String getContext() {
        return context;
    }


    private static String getContextByType(DicCodeEnum type) {
        return getResult(type);
    }

    private static String getContextByTitle(String title) {
        return getResult(title);
    }

    public static String getResult(Object obj) {
        String str = "";
        if (obj instanceof DicCodeEnum) {
            str = ((DicCodeEnum) obj).getTitle();
        } else if (obj instanceof String) {
            str = (String) obj;
        }
        for (DicCodeEnum regPrepareStatusEnum : DicCodeEnum.values()) {
            if (regPrepareStatusEnum.getTitle().equals(str)) {
                return regPrepareStatusEnum.getContext();
            }
        }
        return "";
    }
}
